package java5.io;

import java.util.*;

public class BenchMarking implements Constantes {

    private int[] c0;
    private int[] cx;
    private int[] cn;
    private int[] ck;
    private int[] cj;
    private int[] cc;

    public static void main(String[] args) {
//        BenchMarking b = new BenchMarking();
//        b.prueba();
        CalculoLoser calc = new CalculoLoser(new UtilLoser());

        int[] a = new int[]{2, 0, 6, 7};
        int[][] b = new int[][] {{2,2,3,3}, {1,2,4,5}, {3,1,4,5}, {4,5,7,8}, {0,0,0,2}, {1,1,1,3}};
        long time = 10000000;
        long l1 = System.currentTimeMillis();

        for (int i = 0; i < b.length; i++) {
            System.out.print(Arrays.toString(b[i]));            
        }
        shufflePeones(b, 4);
        System.out.println("");
        for (int i = 0; i < b.length; i++) {
            System.out.print(Arrays.toString(b[i]));            
        }
        
    }

    static void shufflePeones(int[][] ar, int lim) {
        Random rnd = new Random();
        for (int i = lim - 1; i >= 0; i--) {
            int index = rnd.nextInt(i + 1);
            // Simple swap
            int[] a = ar[index];
            ar[index] = ar[i];
            ar[i] = a;
        }
    }
    
    static void shuffleArray(int[] ar) {
        Random rnd = new Random();
        for (int i = ar.length - 1; i >= 0; i--) {
            int index = rnd.nextInt(i + 1);
            // Simple swap
            int a = ar[index];
            ar[index] = ar[i];
            ar[i] = a;
        }
    }

    private void prueba() {

        long time = 1000000;
        long l1 = System.currentTimeMillis();

        for (int k = 0; k < time; k++) {
            if (c0 == null) {
                c0 = new int[]{0, 20, 40, 60, 80};
                cx = new int[]{100, 120, 140, 160, 180};
                cn = new int[]{200, 300, 400, 500, 600};
                ck = new int[]{700, 750};
                cj = new int[]{800, 820, 840, 860};
            } else {
                int t;
                for (int i = 0; i < 5; i++) {
                    t = i * 20;
                    c0[i] = t;
                    cx[i] = 100 + t;
                    cn[i] = 200 + i * 100;
                    if (i < 2) {
                        ck[i] = 700 + i * 50;
                    }
                    if (i < 4) {
                        cj[i] = 800 + t;
                    }
                }
            }
        }

        System.out.println(System.currentTimeMillis() - l1);
        //c0 = cx = cn = ck = cj = null;
        l1 = System.currentTimeMillis();

        for (int k = 0; k < time; k++) {
            c0 = new int[]{0, 20, 40, 60, 80};
            cx = new int[]{100, 120, 140, 160, 180};
            cn = new int[]{200, 300, 400, 500, 600};
            ck = new int[]{700, 750};
            cj = new int[]{800, 820, 840, 860};
        }
        System.out.println(System.currentTimeMillis() - l1);
    }
}
